<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加</title>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
     function callback() {
		var id=$("#id ").val();
		if(id!=""){
			$.getJSON("noServlet","id="+id,function(data){
				if(data.index>0){
					$('#tip').html('代码不可用');
				} else {
					$('#tip').html('代码可以使用');
				}
			});
		}else{
			alert("代码不能为空");
		}
     }
     function mean() {
    	 var titleExsist = $('#titleExsist').val();

			if (titleExsist == 1) {
				return false;
		}
    	 var risk=$("#risk ").val();
    	 var income=$("#income ").val();
    	 var saleStaring=$("#saleStaring ").val();
    	 var saleEne=$("#saleEne ").val();
    	 var end=$("#end ").val();
    	 
    	 if(risk == "0"){
    		 alert("请选择评级");
    		 return false;
    	 }
    	 if(income ==""){
    		 alert("预期收益不能为空");
    		 return false;
    	 }
    	 if(income ==""){
    		 alert("发售起始日不能为空");
    		 return false;
    	 }
    	 if(income ==""){
    		 alert("发售截止日不能为空");
    		 return false;
    	 }
    	 if(income ==""){
    		 alert("产品到期日不能为空");
    		 return false;
    	 }
    	   return true;
	}
			
	
</script>
</head>
<body>
	<form action="addServlet" method="post" onsubmit="return mean()">
		<h2>新增理财信息</h2>
		<br> 
		    <input type="hidden" id="titleExsist" name="titleExsist">
		    <b>产品代码:</b> <input type="text" id="id" name="id"
			style="margin-bottom: 20px; margin-left: 10px" onblur="callback()">
		<span id="tip">*</span> <br> 
		
		<b>风险评级:</b> <select name="risk" id="risk"
			style="margin-bottom: 20px; margin-left: 10px">
			<option value="0">---请选择---</option>
			<option value="1">---R1---</option>
			<option value="2">---R2---</option>
			<option value="3">---R3---</option>
		</select><br> 
		<b>预期收益:</b> <input type="text"
			style="margin-bottom: 20px; margin-left: 10px" name="income" id="income"><br>
		<b>发售起始日:</b> <input type="text"
			style="margin-bottom: 20px; margin-left: 10px" name="saleStaring" id="saleStaring">yyyy-MM-dd格式<br>
		<b>发售截止日:</b> <input type="text"
			style="margin-bottom: 20px; margin-left: 10px" name="saleEne" id="saleEne">yyyy-MM-dd格式<br>
		<b>产品到期日:</b> <input type="text"
			style="margin-bottom: 20px; margin-left: 10px" name="end" id="end">yyyy-MM-dd格式<br>
			<input type="submit" value="提交"> <a href="javascript:history.back(-1);">返回</a>
	</form>
</body>
</html>